package com.yupi.project.model;

import cn.hutool.core.util.BooleanUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AuthenticatorResult {

    // 是否校验成功
    private Boolean isSuccess;
    // 失败原因
    private String errorMsg;

    public static AuthenticatorResult success(){
        return new AuthenticatorResult(true, null);
    }

    public static AuthenticatorResult fail(String errorMsg){
        return new AuthenticatorResult(false, errorMsg);
    }

    // 是否成功
    public boolean isSuccess(){
        return BooleanUtil.isTrue(isSuccess);
    }

}
